package Z06XianCheng.XC07Pool;


import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author 李某
 * * @date 2021/10/20
 * *物有本末，事有终始。知其先后者，则近道矣！
 * *荷花开满池塘的前一天还是半塘荷花半塘云。
 */
public class TestThroud {
    public static void main(String[] args) {
        ThreadPool pool = new ThreadPool();
        int sleep = 1000;
        while(true){
            pool.add(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            });
            try {
                Thread.sleep(1000);
                sleep = sleep>100?sleep-100:sleep;
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        }
    }

class test{
    public static void main(String[] args) {
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10,
                15, 60,
                TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());

            threadPool.execute(new Runnable(){
                @Override
                public void run() {
                    System.out.println("任务1");
                }
            });

        }
    }

